<div class="sign-1 in-div">
    <?php
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        'id' => 'user-form',
        'enableAjaxValidation' => true,
        'enableAjaxValidation' => true,
        'clientOptions' => array(
            'validateOnSubmit' => true,
        ),
        'htmlOptions' => array(
            'enctype' => 'multipart/form-data'
        )
    ));
    ?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>
    <?php if (!$model->isNewRecord) : ?>

        <?php echo $form->textFieldRow($model, 'username', array('class' => 'span5', 'maxlength' => 25, 'readonly' => true)); ?>

        <?php echo $form->textFieldRow($model, 'email', array('class' => 'span5', 'maxlength' => 128, 'readonly' => true)); ?>

    <?php else: ?>

        <?php echo $form->textFieldRow($model, 'username', array('class' => 'span5', 'maxlength' => 25)); ?>

        <?php echo $form->textFieldRow($model, 'email', array('class' => 'span5', 'maxlength' => 128)); ?>

    <?php endif; ?>
    <?php echo $form->passwordFieldRow($model, 'password', array('class' => 'span5', 'maxlength' => 128)); ?>

    <?php echo $form->textFieldRow($model, 'display_name', array('class' => 'span5', 'maxlength' => 128)); ?>

    <?php echo $form->textFieldRow($model, 'first_name', array('class' => 'span5', 'maxlength' => 25)); ?>

    <?php echo $form->textFieldRow($model, 'last_name', array('class' => 'span5', 'maxlength' => 25)); ?>

    <?php echo $form->dropDownListRow($model, 'gender', CMap::mergeArray(array('' => '--Please select--'), User::getGenderRange()), array('class' => 'span5', 'maxlength' => 6)); ?>

    <?php echo $form->textAreaRow($model, 'bio', array('rows' => 6, 'cols' => 50, 'class' => 'span8')); ?>

    <?php echo $form->dropDownListRow($model, 'country', Country::getSelectList(), array('class' => 'span5', 'maxlength' => 45)); ?>

    <?php echo $form->textFieldRow($model, 'state', array('class' => 'span5', 'maxlength' => 45)); ?>

    <?php echo $form->textFieldRow($model, 'city', array('class' => 'span5', 'maxlength' => 45)); ?>

    <?php echo $form->textFieldRow($model, 'address', array('class' => 'span5', 'maxlength' => 255)); ?>

    <?php echo $form->textFieldRow($model, 'phone', array('class' => 'span5', 'maxlength' => 15)); ?>

    <?php echo $form->textFieldRow($model, 'telephone', array('class' => 'span5', 'maxlength' => 45)); ?>

    <?php echo $form->textFieldRow($model, 'mobile', array('class' => 'span5', 'maxlength' => 45)); ?>

    <?php echo $form->textFieldRow($model, 'postcode', array('class' => 'span5', 'maxlength' => 15)); ?>

    <div class="control-group">
        <label class="control-label">Avatar</label>
        <div class="controls">
            <img src="<?php echo $model->getAvatarUrl() ?>" title="" />
            <br/>
            <?php echo CHtml::fileField('avatar') ?>
        </div>
    </div>

    <?php echo $form->textFieldRow($model, 'webpage', array('class' => 'span5', 'maxlength' => 255)); ?>

    <?php echo $form->textFieldRow($model, 'timezone', array('class' => 'span5', 'maxlength' => 45)); ?>

    <?php echo $form->dropDownListRow($model, 'language', array('en' => 'English'), array('class' => 'span5', 'maxlength' => 10)); ?>

    <div class="form-actions">
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'buttonType' => 'submit',
            'type' => 'primary',
            'label' => $model->isNewRecord ? 'Create' : 'Save',
        ));
        ?>
    </div>

    <?php $this->endWidget(); ?>
</div>